<div class="main system-manage">
  <div class="main-header">
    <div class="pa-icon-div pull-left fs-14">
      <i class="iconfont icon-shouye fs-14 icon-vertical-top"></i>
      <span class="fs-vertical-middle">
      <span class="fs-theme-color">系统管理</span>
      </span>
    </div>
  </div>
  <div class="main-content search-info">
    <div class="container-header fs-16">
      <span>{{vm.data.typeName}}配置</span>
    </div>
    <form class="base-info">
      <div class="base-info-item">
        <div class="pa-form-control">
          <label>{{vm.data.typeName}}名称：</label>
          <input type="text" class="pa-form-control-input"
            ng-model="vm.mapParams.name">
        </div>
        <div class="pa-form-control pa-form-control-btn text-right w-100">
          <button class="pa-btn pa-sw-btn" type="button" ng-click="vm.query()">搜索</button>
          <button class="pa-btn pa-sw-btn reset-btn" type="reset" ng-click="vm.reset()">重置</button>
        </div>
      </div>
    </form>
    <div class="pa-table-container" style="background-color: #fff;margin: 0">
      <div class="pa-operate-fr fs-theme-color" ng-click="vm.openAddItemDialog(vm)">
        <i class="iconfont icon-add fs-14"></i>
        <span>新增</span>
      </div>
      <pa-table>
        <table class="pa-table">
          <thead>
            <tr>
              <th ng-if="vm.data.type == 2 || vm.data.type == 3">{{vm.data.typeName}}类别</th>
              <th>{{vm.data.typeName}}名称</th>
              <th>{{vm.data.typeName}}编码</th>
              <th class="operate-three">操作</th>
            </tr>
          </thead>
          <tbody>
            <tr ng-repeat="value in vm.data.tableList">
              <td ng-if="vm.data.type == 2 || vm.data.type == 3">{{value.typeCode == '01' ? '项目部' : value.typeCode == '02' ? '施工队' : '-'}}</td>
              <td>{{value.name||'-'}}</td>
              <td>{{value.code||'-'}}</td>
              <td>
                <div class="operate-del" ng-click="vm.openEditItemDialog(value, vm)">
                  <i class="iconfont icon-xiugai1 edit-color fs-12"></i>
                  <span>修改</span>
                </div>
                <div class="operate-del" ng-click="vm.delete(value)">
                  <i class="iconfont icon-shanchu trash-color fs-12"></i>
                  <span>删除</span>
                </div>
              </td>
            </tr>
          </tbody>
        </table>
      </pa-table>
    </div>
  </div>
</div>
<!-- 新增弹窗 -->
<script type="text/ng-template" id="paAddItemDialog">
  <div class="pa-dialog">
    <div class="pa-dialog-header">
      <div class="title-txt">
        <span>新增{{vm.parentData.typeName}}</span>
      </div>
    </div>
    <div class="pa-dialog-content text-center" ng-class="{'over-width': vm.parentData.type == 5}">
      <div class="pa-form-control pa-width-100">
        <label class="text-right "><b>*</b>{{vm.parentData.typeName}}名称：</label>
        <input type="text" class="form-control-input" placeholder="请输入" ng-model="vm.item.name">
      </div>
      <div class="pa-form-control pa-width-100">
        <label class="text-right "><b>*</b>{{vm.parentData.typeName}}编码：</label>
        <input type="text" class="form-control-input" placeholder="请输入" ng-model="vm.item.code">
      </div>
      <div class="pa-form-control pa-width-100" ng-if="vm.parentData.type == 3 || vm.parentData.type == 2">
        <label class="text-right ">部门类别：</label>
        <select class="form-control-input" placeholder="请输入" ng-model="vm.item.typeCode" ng-options="obj.value as obj.name for obj in vm.parentData.deptTypes">
            <option>请选择</option>
        </select>
      </div>
      <div class="pa-form-control pa-width-100" ng-if="vm.parentData.type == 3 || vm.parentData.type == 2">
        <label class="text-right ">部门类别编码：</label>
        <input type="text" class="form-control-input" placeholder="请输入" readonly="readonly" ng-model="vm.item.typeCode">
      </div>
    </div>
    <div class="pa-dialog-footer text-center">
      <a class="pa-btn" ng-click="vm.submitForm()">
        <span>确定</span>
      </a>
      <a class="pa-btn reset-btn" ng-click="closeThisDialog()">
        <span>取消</span>
      </a>
    </div>
  </div>
</script>
<!-- 编辑弹窗 -->
<script type="text/ng-template" id="paEditItemDialog">
  <div class="pa-dialog">
    <div class="pa-dialog-header">
      <div class="title-txt">
        <span>编辑{{vm.parentData.typeName}}</span>
      </div>
    </div>
    <div class="pa-dialog-content text-center" ng-class="{'over-width': vm.parentData.type == 5}">
      <div class="pa-form-control pa-width-100">
        <label class="text-right "><b>*</b>{{vm.parentData.typeName}}名称：</label>
        <input type="text" class="form-control-input" placeholder="请输入" ng-model="vm.item.name">
      </div>
      <div class="pa-form-control pa-width-100">
        <label class="text-right "><b>*</b>{{vm.parentData.typeName}}编码：</label>
        <input type="text" class="form-control-input" placeholder="请输入" ng-model="vm.item.code">
      </div>
      <div class="pa-form-control pa-width-100" ng-if="vm.parentData.type == 3 || vm.parentData.type == 2">
        <label class="text-right ">部门类别：</label>
        <select class="form-control-input" placeholder="请输入"
          ng-model="vm.item.typeCode" ng-options="obj.value as obj.name for obj in vm.parentData.deptTypes">
          <option>请选择</option>
        </select>
      </div>
      <div class="pa-form-control pa-width-100" ng-if="vm.parentData.type == 3 || vm.parentData.type == 2">
        <label class="text-right">部门类别编码：</label>
        <input type="text" class="form-control-input" readonly="readonly" readonly="readonly" ng-model="vm.item.typeCode">
      </div>
    </div>
    <div class="pa-dialog-footer text-center">
      <a class="pa-btn" ng-click="vm.submitForm()">
        <span>确定</span>
      </a>
      <a class="pa-btn reset-btn" ng-click="closeThisDialog()">
        <span>取消</span>
      </a>
    </div>
  </div>
</script>
